create double format for every model
authorRupert Weber <gimp@leguanease.org>
Sat, 11 Sep 2010 19:17:34 +0000 (21:17 +0200)
committerØyvind Kolås <pippin@gimp.org>
Sun, 12 Sep 2010 16:18:57 +0000 (17:18 +0100)
Changes babl_model_new() to create a respective double format
for every new registered model.

That way applications and extensions can rely on the double
format to always exist.

babl/babl-model.c

index eb7eee429ccb975c354a3e8c0c7d9dbeaab64971..4766b3b4c1233f824ead2c2dcd72d9f18de273c8 100644 (file)
@@ -23,6 +23,8 @@
 #include "babl-internal.h"
 #include "babl-db.h"
 
+static Babl *construct_double_format (Babl *model);
+
 static int
 babl_model_destroy (void *data)
 {
@@ -169,6 +171,7 @@ babl_model_new (void *first_argument,
     {
       babl = model_new (name, id, components, component);
       babl_db_insert (db, babl);
+      construct_double_format (babl);
     }
   else
     {
@@ -224,7 +227,7 @@ static Babl *construct_double_format (Babl *model)
   int   i;
 
   argument[args++] = model;
-  argument[args++] = babl_type ("double");
+  argument[args++] = babl_type_from_id (BABL_DOUBLE);
 
   for (i = 0; i < model->model.components; i++)
     {